package com.nmgdz.bigdata.controller;

import com.nmgdz.bigdata.entity.User;
import com.nmgdz.bigdata.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("user")
public class UserController {
    @Autowired

    private UserService userService;
    @GetMapping("/queruById")
    public User queryById(int id){
        System.out.println("id=["+id+"]");
        return userService.querById(id);

    }


    public User saveUser(String name,int age){
        return userService.save(new User(name,age));

    }














}
